import request from '@/utils/request'

export default{
    //条件查询分页
    pageList(pageNum,pageSize,searchObj){
        return request({
            url: `/order/getOrderPage/${pageNum}/${pageSize}`,
            method: 'post',
            //使用json格式传递 写法data：searchObj
            //使用j普通格式传递 写法params：searchObj
            data:searchObj
          })
    },

    deleteOrderById(id){
        return request({
            url: `/order/deleteOrderById/${id}`,
            method: 'delete',
          })

    },

    saveOrder(order){
        return request({
            url: `/order/addOrder`,
            method: 'post',
            data:order
          })
    },

    getOrderById(id){
        return request({
            url: `/order/getOrderById/${id}`,
            method: 'get',
          })
    },

    updateOrder(order){
        return request({
            url: `/order/updateOrder`,
            method: 'post',
            data:order
          })
    },

    batchRemove(idList) {
        return request({
          url: `/order/removeBatch`,
          method: `delete`,
          data: idList
        })
    },

    getOrderStatusList(){
      return request({
          url: `/orderStatus/getOrderStatusList`,
          method: 'get',
        })
    },

    getOrderByOrderStatus(orderStatus){
      return request({
          url: `/order/getOrderByOrderStatus/${orderStatus}`,
          method: 'get',
        })
    },

    getOrderByUser(){
      return request({
          url: `/order/getOrderByUser`,
          method: 'get',
        })
    },

    updateOrderStatus(id,orderStatusId){
      return request({
          url: `/order/updateOrderStatus`,
          method: 'post',
          params:{
            id: id,
            orderStatusId: orderStatusId
          }
        })
    },


}